﻿//资料下载
var pdId;
var pAddress;
var fnDownLoad = function () {
    var recordID = myDataTable.getSelectedRows()[0];
    record = myDataTable.getRecord(recordID);
    if (record == null) {
        alert("请选择一条记录");
        return;
    }
    pdId = record.getData("<%=EntityId%>");
    pAddress = record.getData("Address");
    document.getElementById("EditUIWindow").src = "../EditWidows/DownLoad.aspx?filename=" + pAddress;
    YAHOO.example.container.dialog1.hidden();
}

//双击事件
function CustomDbClick() {
    var recordID = myDataTable.getSelectedRows()[0];
    record = myDataTable.getRecord(recordID);
    document.getElementById("EditUIWindow3").src = "AutoEditUI.aspx?r=" + Math.random() + "&action=check&entity=" + const_EditEntity + "&id=" + record.getData(const_entityID);
    YAHOO.example.container.dialog5.show();

//    document.getElementById('dialog1_h').innerText = "知识详情";
//    document.getElementById('yui-gen7-button').style.display = "none";
}
if (typeof ($) != "undefined") {
    $(document).ready(function () {
        try {
            var varStr = $("form").attr("action");
            var arr = varStr.split('&');
            var arr2 = new Array();
            for (var i = 1; i < arr.length; i++) {
                arr2.push(arr[i]);                                   
            }
            var varCheck = arr2[0].substring(7, arr2[0].length);
            if (varCheck == "check") {
                $("#AttachName").attr("disabled", "disabled");
                $("#ParentID").attr("disabled", "disabled");
                $("#IsFirstPageView").attr("disabled", "disabled");
                $("#Address").attr("disabled", "disabled");
                $("#ActivitySumary").attr("disabled", "disabled");
                $("#Explain").attr("disabled", "disabled");    
            }
        } catch (Error) { }
    })
}

var formatText = function (elCell, oRecord, oColumn, sData) {
    sData.replace("[BR]","");
    if (sData.length > 30) {
        elCell.innerHTML = sData.substring(0, 30) + "..." + "<a href='javascript:CustomDbClick()'>详细</a>";
    }
    else {
        elCell.innerHTML = sData;
    }
};